package itextcode;

// TableDemo2.java

import java.awt.Color;
import java.io.*;

import com.lowagie.text.*;
import com.lowagie.text.pdf.*;

class TableDemo2
{
  public static void main (String [] args) throws Exception
  {
   Document doc = new Document ();
   PdfWriter.getInstance (doc, new FileOutputStream ("C://Borland/Together/Architect2006/workspace/checkout svn/itextcode/generated_documents/tabledemo2.pdf"));
   doc.open ();

   // Create a 2-column table. Instead of the default 80% of the available
   // page, have the table take up 90% of the available page. Also, make
   // the second column twice as wide as the first column.

   PdfPTable table = new PdfPTable (new float [] { 1.0f, 2.0f });
   table.setWidthPercentage (90.0f);

   // Create and add a title across both columns.

   PdfPCell cell = new PdfPCell (new Paragraph ("New Mustang Features"));
   cell.setColspan (2);
   cell.setHorizontalAlignment (Element.ALIGN_CENTER);
   cell.setBackgroundColor (new Color (128, 255, 128));
   cell.setPadding (10.0f);
   table.addCell (cell);

   // Add header cells for these columns.

   cell = new PdfPCell (new Paragraph ("Feature"));
   cell.setHorizontalAlignment (Element.ALIGN_CENTER);
   cell.setBackgroundColor (new Color (255, 255, 0));
   cell.setPadding (10.0f);
   table.addCell (cell);

   cell = new PdfPCell (new Paragraph ("Description"));
   cell.setHorizontalAlignment (Element.ALIGN_CENTER);
   cell.setBackgroundColor (new Color (0, 255, 255));
   cell.setPadding (10.0f);
   table.addCell (cell);

   // Add the first row.

   table.addCell ("Splash screens");
   table.addCell ("Show a splash screen during application startup. " +
           "Supports GIF, JPEG, and PNG image formats. Includes " +
           "support for transparency and animation as supported " +
           "by the image format. Lets you plug into the splash " +
           "screen via a simple API, to display runtime messages, " +
           "application loading progress, and so on.");

   // Add a separator row -- for neatness.

   table.addCell (" ");
   table.addCell (" ");

   // Add the second row.

   table.addCell ("System tray API");
   table.addCell ("Add a Java application to a system's app-launching " +
           "panel/toolbar. Create a \"tray icon\", add the icon " +
           "to the \"system tray area,\" and listen for various " +
           "events.");

   // Add the table to the document.

   doc.add (table);

   doc.close ();
  }
}